#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 5000

FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY ["RuYiAdmin.Net.WebApi/RuYiAdmin.Net.WebApi.csproj", "RuYiAdmin.Net.WebApi/"]
COPY ["RuYiAdmin.Net.DataModel/RuYiAdmin.Net.DataModel.csproj", "RuYiAdmin.Net.DataModel/"]
COPY ["RuYiAdmin.Net.UniversalFoundation/RuYiAdmin.Net.UniversalFoundation.csproj", "RuYiAdmin.Net.UniversalFoundation/"]
COPY ["RuYiAdmin.Net.DataRepository/RuYiAdmin.Net.DataRepository.csproj", "RuYiAdmin.Net.DataRepository/"]
COPY ["RuYiAdmin.Net.SystemService/RuYiAdmin.Net.SystemService.csproj", "RuYiAdmin.Net.SystemService/"]
RUN dotnet restore "RuYiAdmin.Net.WebApi/RuYiAdmin.Net.WebApi.csproj"
COPY . .
WORKDIR "/src/RuYiAdmin.Net.WebApi"
RUN dotnet build "RuYiAdmin.Net.WebApi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "RuYiAdmin.Net.WebApi.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "RuYiAdmin.Net.WebApi.dll"]